<?php 
 header("Content-type:text/html;charset=utf8");
 require_once("../Const.php");

  $conn = new mysqli(host,mysql_username,mysql_password);
  
  if (!$conn) {
  	die("连接失败".$conn->connect_error);
  }
   $conn -> select_db("objc_db");
   $conn -> set_charset('utf8');
   echo "<br>字符集".$conn -> character_set_name()."<br>";
   
   $sql = 'SELECT mark, firstName, lastName, email FROM MyGuests';
   $result = $conn -> query($sql);
   if (!$result) {
     die("查询失败".$conn->error);
   }
   // fetch_assoc以关联数组返回结果
   // fetch_num以索引数据返回结果
   if ($result->num_rows > 0) {
     while ($row = $result->fetch_assoc()) {
       var_dump($row);
     }
   } else {
      echo "0个结果";
   }





  echo "成功";
  $conn -> close();

 ?> 